CFLAGS = -fpic -coverage -lm -std=c99

rngs.o: rngs.h rngs.c
	gcc -c rngs.c -g  $(CFLAGS)

dominion.o: dominion.h dominion.c rngs.o
	gcc -c dominion.c -g  $(CFLAGS)

playdom: dominion.o playdom.c
	gcc -o playdom playdom.c -g dominion.o rngs.o $(CFLAGS)
	
testDrawCard: testDrawCard.c dominion.o rngs.o
	gcc -o testDrawCard -g  testDrawCard.c dominion.o rngs.o $(CFLAGS)

campbeku3: campbeku3.c dominion.o rngs.o
	gcc -o campbeku3 -g campbeku3.c dominion.o rngs.o $(CFLAGS)

badTestDrawCard: badTestDrawCard.c dominion.o rngs.o
	gcc -o badTestDrawCard -g  badTestDrawCard.c dominion.o rngs.o $(CFLAGS)

testBuyCard: testDrawCard.c dominion.o rngs.o
	gcc -o testDrawCard -g  testDrawCard.c dominion.o rngs.o $(CFLAGS)

testAll: dominion.o testSuite.c
	gcc -o testSuite testSuite.c -g  dominion.o rngs.o $(CFLAGS)

interface.o: interface.h interface.c
	gcc -c interface.c -g  $(CFLAGS)

runtests: testDrawCard 
	./testDrawCard &> unittestresult.out
	gcov dominion.c >> unittestresult.out
	cat dominion.c.gcov >> unittestresult.out

player: player.c interface.o
	gcc -o player player.c -g  dominion.o rngs.o interface.o $(CFLAGS)

TESTFLAGS = -lm -std=c99 -ftest-coverage -fprofile-arcs

unittest1: unittest1.c
	gcc unittest1.c -o unittest1 $(TESTFLAGS)

unittest2: unittest2.c
	gcc unittest2.c -o unittest2 $(TESTFLAGS)

unittest3: unittest3.c
	gcc unittest3.c -o unittest3 $(TESTFLAGS)

unittest4: unittest4.c
	gcc unittest4.c -o unittest4 $(TESTFLAGS)

cardtest1: cardtest1.c
	gcc cardtest1.c -o cardtest1 $(TESTFLAGS)

cardtest2: cardtest2.c
	gcc cardtest2.c -o cardtest2 $(TESTFLAGS)

cardtest3: cardtest3.c
	gcc cardtest3.c -o cardtest3 $(TESTFLAGS)

cardtest4: cardtest4.c
	gcc cardtest4.c -o cardtest4 $(TESTFLAGS)
	
unittestresults.out: unittest1 unittest2 unittest3 unittest4 cardtest1 cardtest2 cardtest3 cardtest4 dominion.o
	./unittest1; 
	gcov unittest1.c >> unittestresult.out
	cat unittest1.c.gcov >> unittestresult.out
	cat dominion.c.gcov >> unittestresult.out
	./unittest2;
	gcov unittest2.c >> unittestresult.out
	cat unittest2.c.gcov >> unittestresult.out
	cat dominion.c.gcov >> unittestresult.out
	./unittest3;	
	gcov unittest3.c >> unittestresult.out
	cat unittest3.c.gcov >> unittestresult.out
	cat dominion.c.gcov >> unittestresult.out
	./unittest4;
	gcov unittest4.c >> unittestresult.out
	cat unittest4.c.gcov >> unittestresult.out
	cat dominion.c.gcov >> unittestresult.out
	./cardtest1;
	gcov cardtest1.c >> unittestresult.out
	cat cardtest1.c.gcov >> unittestresult.out	
	cat dominion.c.gcov >> unittestresult.out
	./cardtest2;
	gcov cardtest2.c >> unittestresult.out
	cat cardtest2.c.gcov >> unittestresult.out
	cat dominion.c.gcov >> unittestresult.out
	./cardtest3;
	gcov cardtest3.c >> unittestresult.out
	cat cardtest3.c.gcov >> unittestresult.out
	./cardtest4;
	gcov cardtest4.c >> unittestresult.out
	cat cardtest4.c.gcov >> unittestresult.out
	cat dominion.c.gcov >> unittestresult.out

	
all: playdom player testDrawCard testBuyCard badTestDrawCard

clean:
	rm -f *.o playdom.exe playdom test.exe test player player.exe testInit testInit.exe *.gcov *.gcda *.gcno *.so

	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
